function Board(){

	var that = this
	this.phase;
	this.resources;
	this.kingdom;
	this.trash;
	this.prizes;
	this.embargo;
	this.traderoute;
	this.spoils;
	this.ruins;
	this.mercenary;
	this.madman;
	this.rid;
	
	this.parseresults = function(data) {
		that.phase = data.player.phase;
		that.resources = data.resources;
		that.kingdom = data.board.kingdom;
		that.trash = data.board.trash;
		that.prizes = data.board.prizes;
		that.embargo = data.board.embargo;
		that.traderoute = data.board.traderoute;
		that.blackmarket = data.board.blackmarket;
		that.bane = data.board.bane
		that.spoils = data.board.spoils
		that.ruins = data.board.ruins;
		that.mercenary = data.board.mercenary;
		that.madman = data.board.madman
		that.rid = data.roomid;
		that.generatehtml()
	}
	
	this.generatehtml = function() {

		htmldata = "";
		if (that.phase == "Payment" || that.phase == "Buy")
			//the passing phase should be 'Buy', because those are board cards, and we want to attach buy function to them, and not payment
			htmldata += kingdomCards2html('Kingdom', that.kingdom, that.resources, "Buy", true)
		else
			htmldata += kingdomCards2html('Kingdom', that.kingdom, that.resources, null, true)
		htmldata += "<br>";
		
		
		if (that.prizes.length > 0)
			htmldata += cards2html('Prizes', that.prizes, "Various prizes you can earn with Tournament", null, null, true);
		if (that.embargo.length > 0)
			htmldata += cards2html('Embargo', that.embargo, "List of all embargoed cards in game", null, null, true);
		if (that.bane.length > 0)
			htmldata += cards2html('Bane', that.bane, "Bane card in game used agains Young Witch", null, null, true);
		if (that.traderoute.length > 0)
			htmldata += cards2html('Traderoute', that.traderoute, "Trade Route tokens arleady worth coin", null, null, true);
		if (that.spoils)
			htmldata += num2html('Spoils', that.spoils, "Spoils pile: +3$. When you play this, return it to the Spoils pile.", null, null, false);
		if (that.mercenary)
			htmldata += num2html('Mercenary', that.mercenary);
		if (that.madman)
			htmldata += num2html('Madman', that.madman);
		if (that.blackmarket.length) {
			htmldata += cards2html('Black Market', that.blackmarket, null, null, null, false);		
		}
		
		htmldata += displayBeautifulString('Trash', that.trash);
		
		var sec_board = document.getElementById('sec_board');
		sec_board.innerHTML = htmldata;

		
	
		var rid = document.getElementById('roomid');
		rid.innerHTML = that.rid;

		// Add tool tips to cards
		$(".hastooltip").tooltip( {predelay: 1250});
		$(".hastooltip").dynamic();
	}
	
			
}

